package hust.rpc.client;


import hust.rpc.client.pull.DiscoveryService;
import hust.rpc.common.HelloService;
import hust.rpc.common.RegistryCenter;

import java.util.concurrent.CountDownLatch;

/**
 * 客户端启动类
 */
public class ClientBootStrap {

    /**
     * 用来保持与拉取服务线程之间的同步
     */
    public static CountDownLatch c = new CountDownLatch(1);

    public static void main(String[] args) throws InterruptedException {

        DiscoveryService.start();

        c.await();

        HelloService service = (HelloService) ClientProxy.getBean(HelloService.class);

        for (int i = 0; i < 1000; i++) {
            System.out.println(service.hello("hello world"));
        }
    }
}
